# Maintainer: Eric Bélanger <eric@archlinux.org>

pkgname=fbida
pkgver=2.14
pkgrel=5
pkgdesc="Few applications to display and elementary edit images: fbi, fbgs, ida, exiftran"
arch=('loong64' 'x86_64')
url="https://www.kraxel.org/blog/linux/fbida/"
license=('GPL2')
depends=('libexif' 'libepoxy' 'poppler-glib' 'libwebp' 'mesa')
makedepends=('libxpm' 'imagemagick' 'libxpm' 'openmotif')
optdepends=('ghostscript: to use fbgs' 'openmotif: for ida' 'libxpm: for ida')
source=(https://www.kraxel.org/releases/${pkgname}/${pkgname}-${pkgver}.tar.gz{,.asc}
        ida-desktop.patch
        fbida-gcc10.patch::"https://gitlab.com/kraxel/fbida/-/commit/1bb8a8aa.patch")
sha1sums=('fe2ec92dc98296e46cd8ddddcd8b3a169cb506a0'
          'SKIP'
          'd06b70f2d581a1a3e9e0909b5af7f3f71ed54717'
          '6d0f3b9784e47a126384b5af70f42d63f4d54b76')
sha256sums=('95b7c01556cb6ef9819f358b314ddfeb8a4cbe862b521a3ed62f03d163154438'
            'SKIP'
            '51dabac02c6326e7f2d28db304f0b481cbcef7371807eb93618b2b5eb0104907'
            '3a76829dba124b542631cb3d78da6414a339e1cbb3bf5c6451d677f51bcf3c76')
validpgpkeys=('A0328CFFB93A17A79901FE7D4CB6D8EED3E87138')

prepare() {
  cd ${pkgname}-${pkgver}
  patch -p0 -i "${srcdir}/ida-desktop.patch"
  patch -p1 -i ../fbida-gcc10.patch # Fix build with GCC 10
  echo 2.13 > VERSION
}

build() {
  cd ${pkgname}-${pkgver}
  make verbose=yes
  convert +set date:create +set date:modify -resize 25% logo.jpg ida.png
}

package() {
  cd ${pkgname}-${pkgver}
  make STRIP="" DESTDIR="${pkgdir}" prefix=/usr install
  install -D -m644 desktop/ida.desktop "${pkgdir}/usr/share/applications/ida.desktop"
  install -D -m644 ida.png "${pkgdir}/usr/share/pixmaps/ida.png"
}
